< previous page page_15 next page >

Page 15
Puzzle 1
Where, Oh, Where Is That API Call?
It's a small world, and you never know when you might need to adapt your software to run correctly in other parts of the world. Awkward though it may be, other countries stubbornly insist on using their own languages, currency symbols, and punctuation marks. They even arrange date and time formats in different orders.1
Windows uses the term "locale" to identify a locality and its characteristics. Each locale has a unique number. Fortunately, Windows makes it easy to find out the characteristics of the locale under which your application is running.
Here's a simple program you can use to obtain the number of the current locale:
Private Declare Function GetUserDefaultLcid Lib "User32" () As Long

Private Sub Command1_Click()
   Dim lcid&
   Dim info$
   lcid = GetUserDefaultLcid()
   MsgBox lcid, vbOKOnly, "User Default LCID"
End Sub
Results
Runtime error 453:
Can't find DLL entry point GetUserDefaultLcid in User32
Where, oh, where, can you find the API call? Fix the declaration to make this program work.
7017a6ead0e3c4111b47a554df321e9f.gif 7017a6ead0e3c4111b47a554df321e9f.gif
1 Lest I be accused of being U.S.centric right from the start, allow me to point out that the above paragraph is relevant regardless of which primary language and country you are developing for.

 
< previous page page_15 next page >